package com.hpu.service;

import android.content.Context;
import android.os.Handler;

import com.hpu.callback.AllScoreCallback;
import com.hpu.callback.BookBorrowCallback;
import com.hpu.constants.HttpConstants;
import com.hpu.constants.ShareConstants;
import com.hpu.constants.UrlConstants;
import com.hpu.interceptor.ReceivedCookieInterceptor;
import com.hpu.tools.InternetTools;
import com.hpu.tools.OkHttpTools;
import com.hpu.tools.ShareTools;

/**
 * 期末成绩业务类
 * @author Administrator
 *
 */
public class BookBorrowService {

	private Handler handler;

	private Context context;

	public BookBorrowService(Handler handler, Context context) {
		this.handler=handler;
		this.context=context;
	}

	public void getBorrow(String id) {
		if(InternetTools.statusInternet(context)==InternetTools.NO_INTERNET)
			handler.sendEmptyMessage(HttpConstants.NO_INTERNET);
		else
			OkHttpTools.getByCookie(UrlConstants.getBookBorrowDetail(id),
					ShareTools.get(context, ShareConstants.STORE_LOGINCOOKIE, "").toString(),
					new BookBorrowCallback(handler));
		
	}

}
